package cn.iocoder.aics.module.member.framework.web.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.client.WebClient;

@Configuration
public class DeepseekConfig {

    @Bean
    public WebClient deepseekWebClient() {
        //    @Value("${deepseek.api.key}")
        String apiKey = "sk-73340245cafe4ed893e058424d276656";
        return WebClient.builder()
                .baseUrl("https://api.deepseek.com/v1")
                .defaultHeader(HttpHeaders.AUTHORIZATION, "Bearer " + apiKey)
                .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
                .codecs(configurer ->
                        configurer.defaultCodecs().maxInMemorySize(10  * 1024 * 1024)) // 10MB缓存
                .build();
    }
}
